package thomas.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import thomas.web.entity.Resident;
import thomas.web.service.LoginSevice;
import thomas.web.service.ResidentSevice;

@Controller
@RequestMapping("/login")
public class LoginController {
	
	@Autowired
	private LoginSevice loginSevice;
	
	@RequestMapping(method = RequestMethod.POST)
	public String login(Resident resident){
		if(loginSevice.validateResident(resident)){
			return "home";
		}else{
			return "login";
		}
	}

	@GetMapping
	 public String toLogin(){
		 return "login";
	 }

	 
	 
	 
	 
 
	
}
